<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>text ellipsis</title>
    <style>
        .ellipsis {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .resize {
            resize: horizontal;
            overflow: hidden;
        }        
    </style>
</head>
<body>
    <h1>text ellipsis</h1>
    <h2>单行文本省略</h2>
    <style>
        .demo01 {
            width:200px; 
            height: 1em; 
            background-color: aqua;
            padding: 2px 0px;            
        }
    </style>    
    <div class="demo01 ellipsis resize">
        这是一段很长很长很长很长很长很长很长很长很长很长的问题
    </div>
    <h2>单行文本省略(文本自适应)</h2>
    <style>
        .demo02 {
            width:200px; 
            height: 1em; 
            display: flex;
            border: 1px solid #ccc;
            padding: 2px 0px;
        }
        .demo02 span {
            background-color: aqua;
            flex: 1;
        }
        .demo02 button {
            margin-left: 10px;
        }        
    </style>    
    <div class="demo02 resize">
        <span class="ellipsis">这是一段很长很长很长很长很长很长很长很长很长很长的问题</span>
        <button>placeholder</button>
    </div>      
</body>
</html>